package com.zte.common.control;

import com.zte.common.service.CommonDeptJobUserService;
import com.zte.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CacheConfig(cacheNames = "commonDeptJobUser")
@RequestMapping("/commonDeptJobUser")
public class CommonDeptJobUser {
    @Autowired
    private CommonDeptJobUserService deptJobUserService;
    //获取所有部门用户信息
    @GetMapping
    @Cacheable
    public ResultMessage getAllDeptJobUser(){
        return new ResultMessage(200,true,"success",deptJobUserService.getDeptJobUser(null));
    }
    @GetMapping("/{userId}")
    @Cacheable
    public ResultMessage getProvinceByUid(@PathVariable Integer userId){
        return new ResultMessage(200,true,"success", deptJobUserService.getDeptJobUser(userId));
    }
}
